
import * as home from './action-type';
let defaultState = {
    /**
     * 商品数据
     * @type {Array}
     * example: [{
     *    product_id: 1, 商品ID 
     *    product_name: "PaiBot（2G/32G)", 商品名称
     *    product_price: 2999, 商品价格
     *    commission: 200, 佣金
     *    selectStatus: false, 是否选择
     *    selectNum: 0, 选择数量
     * }]
     */
    name: '333',
    age: 12
}
// 首页表单数据
export const formData = (state = defaultState, action = {}) => {
    switch (action.type) {
        case home.SAVEFORMDATA:
            console.log({ ...state, ...action.value })
            return { ...state, ...action.value }
        case home.SAVEIMG:
            return { ...state, ...{ imgpath: action.path } };
        case home.CLEARDATA:
            return { ...state, ...defaultState };
        default:
            return state;
    }
}
export const editorData = (state = defaultState, action = {}) => {
    switch (action.type) {
        case home.CHANGEDATA:
            return { ...state, ...action.value }
        default:
            return state;
    }
}